<?php header('Content-Type: text/html; charset=utf-8'); ?>
<html>
<head>
<title>Hurmpf - Admin</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script language="JavaScript" src="../ajax.js"></script>
<script language="JavaScript" src="admin.js"></script>
</head>
<body>

<?php
	include("../config.php"); // paramètres
	dbconnect();
	include("functions.php"); // fonctions de l'interface d'admin
	if(empty($_GET['id'])) die("erreur");
	$id = $_GET['id'];
?>

<ul id="menu">
	<li><a href="../">Retour au blog</a></li>
</ul>

<hr>

<?php	
	echo '<form>';
	$sql = 'SELECT * FROM comments WHERE id='.$id;
	$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); 
	$row = mysql_fetch_array($req);
	$date = $row ['date'];
	$nom = $row ['nom'];
	$email = $row ['email'];
	$web = $row ['web'];
	$texte = $row ['texte'];
	$texte = str_replace("&","&amp;",$texte);
	echo '<p>Nom : <input type="text" id="editName" maxlength="255" size="100" value="'.str_replace('"','&quot;',$nom).'">';
	echo '<p>Email : <input type="text" id="editMail" maxlength="255" size="100" value="'.str_replace('"','&quot;',$email).'">';
	echo '<p>Web : <input type="text" id="editWeb" maxlength="255" size="100" value="'.str_replace('"','&quot;',$web).'">';
	echo '<p><textarea name="texte" rows="25" cols="120" id="editText">'.$texte.'</textarea>';
	echo ' <p><input type="button" value="Valider" onClick="editComm('.$id.')">';
	echo ' <input type="button" value="Effacer" onClick="deleteComm('.$id.')">';
	echo '</form>';
?>

</body>
</html>